var go_top=document.getElementById("go_top"),
	scroll=document.body.scrollTop,
	h=document.body.scrollTop,
	is_run=false;
	
//点击回到顶部	
go_top.onclick=function(){
	scrToTop(40);
}
function scrToTop(num){
	var scrTop=document.documentElement.scrollTop+document.body.scrollTop;
	if(scrTop>0)
	{
		if(document.all)//支持IE
			scrTop-=num*2;
		else//非IE
			scrTop-=num;//scrTop=scrTop-num;			
		document.documentElement.scrollTop=scrTop;
		document.body.scrollTop=scrTop;
		return window.setTimeout(function(){scrToTop(num);},5);
	}
}

//滚动监听
window.addEventListener("scroll",function(){	
	if(!is_run){
//		console.log(111)
		body_h=document.documentElement.scrollTop+document.body.scrollTop;
//		console.log(body_h)
		if(body_h>220){
			go_top.style.bottom='20%';
		}else{
			go_top.style.bottom='';
		}
	}
	var hh=document.documentElement.scrollTop+document.body.scrollTop;
//!is_run?hh>560?go_top.style.display='block':go_top.style.display='':'';
})